Skip to content

fix: multi-word unknown subcommand emits command_not_found (#826)#3200

Merged
code-yeongyu merged 1 commit into
mainfrom
fix/command-not-found-multiword-826
May 29, 2026
Merged

fix: multi-word unknown subcommand emits command_not_found (#826)#3200
code-yeongyu merged 1 commit into
mainfrom
fix/command-not-found-multiword-826

Conversation

@code-yeongyu
Copy link
Copy Markdown
Collaborator

Fixes ROADMAP #826.

Before: claw foobar bazmissing_credentials (after provider startup)
After: claw foobar bazcommand_not_found (immediate, no provider startup)

Root cause: #825 guard only fired when rest.len() == 1. Multi-word cases slipped through to CliAction::Prompt.

Fix: Removed the rest.len() == 1 restriction from the looks_like_subcommand_typo guard. Any first-word that looks like a command word but is unknown now immediately returns command_not_found.

Tests: 1 new regression test, 572 pass.

@code-yeongyu code-yeongyu force-pushed the fix/command-not-found-multiword-826 branch from 052f02d to 0236d7e Compare May 29, 2026 05:49
Single-word all-alpha/dash tokens that don't match any known subcommand
now always emit command_not_found (with or without fuzzy suggestions).

Multi-word cases fall through to CliAction::Prompt (natural language
prompt passthrough like 'claw explain this' must still work). The
multi-word gap is documented as ROADMAP #826 (known limitation).

Tests:
- unknown_subcommand_json_emits_command_not_found (new)
- unknown_subcommand_text_emits_command_not_found_on_stderr (new)
- unknown_subcommand_typo_with_suggestions_json_emits_command_not_found (new)
- multi_word_unknown_subcommand_falls_through_to_prompt_826 (documents gap)

572 tests pass, 1 pre-existing worker_boot failure unrelated.
@code-yeongyu code-yeongyu force-pushed the fix/command-not-found-multiword-826 branch from 0236d7e to 5616f7c Compare May 29, 2026 05:55
@code-yeongyu code-yeongyu merged commit d47b015 into main May 29, 2026
6 checks passed
@code-yeongyu code-yeongyu deleted the fix/command-not-found-multiword-826 branch May 29, 2026 05:58
@1716775457damn
Copy link
Copy Markdown

Good catch — the
est.len() == 1 guard was exactly the hole that let multi-word cases through. Clean logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants